package tom.client;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;

public abstract class AppPanel extends DockLayoutPanel {
	protected Label header;
	protected Grid control;

	public AppPanel() {
		super(Unit.PX);
		this.setPixelSize(MainPanel.WIDTH, MainPanel.HEIGHT);
		header = new Label("HEADER");
		// header.setHorizontalAlignment(Label.ALIGN_CENTER);
		header.setStyleName("subtitle");

		control = new Grid(10, 1);
		control.setCellSpacing(5);
		control.setPixelSize(200, 600);
		control.setStyleName("form");

		this.addNorth(header, 35);
		this.addEast(control, 180);

		Button btnRefresh = new Button("Refresh");
		btnRefresh.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				clear();
			}
		});
		control.setWidget(0, 0, btnRefresh);
		btnRefresh.setSize("150px", "25px");
	}

	public void setTitle(String title) {
		super.setTitle(title);
		header.setText(title);
	}

	public abstract void refresh();

	public void setParams() {

	}
}
